package cn.wolfcode.p2p.util;

public class JsonResult {
    private boolean success = true;
    private String msg;

    public boolean isSuccess() {
        return success;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.success=false;
        this.msg = msg;
    }

    /**
     *定义instance方法,方便传参给controller
     * @return
     */
    public static JsonResult instance(){
        return new JsonResult();
    }

    /**
     * 如果后台抛了异常,下面的instance方法就会带上错误信息传值
     * @param errorMsg
     * @return
     */
    public static JsonResult instance(String errorMsg){
        JsonResult jsonResult = new JsonResult();
        jsonResult.setMsg(errorMsg);
        return jsonResult;
    }

}
